package com.jt.demo7_di;


public class Person {
    private Integer id;
    private String name;
//    private Car car = new Car(); 耦合性高
    private Car car;//Spring容器为属性赋值

    public Car getCar() {
        return car;
    }

    public void setCar(Car car) {
        this.car = car;
    }

    public void sayHi(){
         System.out.println("你好："+id+":"+name);
     }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    public void toGo(){
        car.go();
    }
}
